package day08;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

public class FilePra {
    public static void main(String[] args) {

        System.out.println("当前工作目录: " + System.getProperty("user.dir"));

        // 检查文件是否存在
        File file = new File("file.txt");
        System.out.println("查找的文件路径: " + file.getAbsolutePath());
        System.out.println("文件是否存在: " + file.exists());


        try {
            List<String> lines = Files.readAllLines(Paths.get("file.txt"));
            for (String line : lines) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
